package com.csx.base.design.structure.facade;


/**
 * 门面模式
 * @author 28618
 */
public class Facade {

    private VegVendor vegVendor;
    private Chef chef;
    private Waiter waiter;
    private Cleaner cleaner;

    public Facade() {

        this.vegVendor = new VegVendor();
        // 开门前找蔬菜商准备好蔬菜
        vegVendor.purchase();
        // 雇佣厨师
        this.chef = new Chef();
        // 雇佣服务员
        this.waiter = new Waiter();
        // 雇佣洗碗工
        this.cleaner = new Cleaner();
    }

    public void order() {

        // 服务员接待，入座，点菜
        waiter.order();

        // 找厨师做饭
        chef.cook();

        // 服务员上菜
        waiter.serve();

        // 洗碗工清桌子
        cleaner.clean();

        // 洗碗工洗碗
        cleaner.wash();
    }

    public static void main(String[] args) {
        Facade facade = new Facade();
        facade.order();
    }
}
